' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.11.19.18.55]) on 2023.11.24 at 04:51 (Coordinated Universal Time)
' BAM port of Jason Anthony's QB64 program (https://sourceforge.net/projects/fish-screensaver-for-win-10/)


Dim a As Integer 'Creates these variables and declares them as whole numbers
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim Color1 As Integer
Dim Color2 As Integer
Dim Counter As Integer
Dim MoveRight As Integer
Dim MoveRight2 As Integer
Screen _NewImage(640, 360, 17) 'Widescreen low resolution
a = 690 'Starting point for Left moving fish
b = 300
c = -100 'Starting point for Right moving fish
d = 100
Color1 = 1 'Starting color for Left moving fish
Color2 = 5 'Starting color for Right moving fish
Counter = 0 'creates values for variables
MoveRight = 0
MoveRight2 = 0
Do 'Starts main loop
    Cls 'Erases old image after new image appears to avoid trail of images
    _delay 0.02

    Line (a + 13, b + 0)-(a + 18, b + 2), Color1, BF 'Left moving fish sprite - (a,b) above creates starting point - Line 1
    Line (a + 8, b + 2)-(a + 13, b + 4), Color1, BF 'Line 2
    Line (a + 18, b + 2)-(a + 23, b + 4), Color1, BF
    Counter = Counter + 1 'This starts a counting sequence
    If Counter = 21 Then Counter = 0 'This limits counting to 20, then restarts at 0
    If Counter < 20 * .7 Then Line (a + 33, b + 2)-(a + 35, b + 4), Color1, BF 'This line is shown for .7 frames of the total 20 frames per second
    Line (a + 5, b + 4)-(a + 8, b + 6), Color1, BF 'Line 3
    Line (a + 23, b + 4)-(a + 25, b + 6), Color1, BF
    Line (a + 30, b + 4)-(a + 33, b + 6), Color1, BF
    Line (a + 3, b + 6)-(a + 5, b + 8), Color1, BF 'Line 4
    Line (a + 9, b + 6)-(a + 11, b + 8), Color1, BF
    Line (a + 23, b + 6)-(a + 30, b + 8), Color1, BF
    Line (a + 0, b + 8)-(a + 3, b + 10), Color1, BF 'Line 5
    If Counter < 20 * .5 Then Line (a + 15, b + 8)-(a + 18, b + 10), Color1, BF
    Line (a + 28, b + 8)-(a + 30, b + 10), Color1, BF
    Line (a + 0, b + 10)-(a + 3, b + 12), Color1, BF 'Line 6
    Line (a + 13, b + 10)-(a + 15, b + 12), Color1, BF
    If Counter < 20 * .5 Then Line (a + 15, b + 10)-(a + 18, b + 12), Color1, BF
    Line (a + 28, b + 10)-(a + 30, b + 12), Color1, BF
    Line (a + 3, b + 12)-(a + 8, b + 14), Color1, BF 'Line 7
    Line (a + 23, b + 12)-(a + 30, b + 14), Color1, BF
    Line (a + 5, b + 14)-(a + 8, b + 16), Color1, BF 'Line 8
    Line (a + 23, b + 14)-(a + 25, b + 16), Color1, BF
    Line (a + 30, b + 14)-(a + 33, b + 16), Color1, BF
    Line (a + 8, b + 16)-(a + 13, b + 18), Color1, BF 'Line 9
    Line (a + 18, b + 16)-(a + 23, b + 18), Color1, BF
    If Counter < 20 * .7 Then Line (a + 33, b + 16)-(a + 35, b + 18), Color1, BF
    Line (a + 13, b + 18)-(a + 18, b + 20), Color1, BF 'End of left moving fish sprite - Line 10

    If a > 640 Then MoveRight = -1 'Defines movement is to the left
    If MoveRight = -1 Then a = a - 1
    If a = -100 Then a = a + 800 'Stops Movement at -100, then starts again at 800
    If a = -99 Then Color1 = Color1 + 1 'Creates color change for every trip
    If Color1 = 16 Then Color1 = 1 'This limits color to 15, then restarts at 1
    If a = -98 Then b = Rnd * 280 + 20 'Creates different starting height for fish path every trip

    Line (c + 22, d + 0)-(c + 17, d + 2), Color2, BF 'Right moving fish sprite - (c,d) above creates starting point - Line 1
    Line (c + 27, d + 2)-(c + 22, d + 4), Color2, BF 'Line 2
    Line (c + 17, d + 2)-(c + 12, d + 4), Color2, BF
    Counter = Counter + 1
    If Counter = 21 Then Counter = 0
    If Counter < 20 * .7 Then Line (c + 2, d + 2)-(c + 0, d + 4), Color2, BF
    Line (c + 30, d + 4)-(c + 27, d + 6), Color2, BF 'Line 3
    Line (c + 12, d + 4)-(c + 10, d + 6), Color2, BF
    Line (c + 5, d + 4)-(c + 2, d + 6), Color2, BF
    Line (c + 32, d + 6)-(c + 30, d + 8), Color2, BF 'Line 4
    Line (c + 26, d + 6)-(c + 24, d + 8), Color2, BF
    Line (c + 12, d + 6)-(c + 5, d + 8), Color2, BF
    Line (c + 35, d + 8)-(c + 32, d + 10), Color2, BF 'Line 5
    If Counter < 20 * .5 Then Line (c + 20, d + 8)-(c + 17, d + 10), Color2, BF
    Line (c + 7, d + 8)-(c + 5, d + 10), Color2, BF
    Line (c + 35, d + 10)-(c + 32, d + 12), Color2, BF 'Line 6
    Line (c + 22, d + 10)-(c + 20, d + 12), Color2, BF
    If Counter < 20 * .5 Then Line (c + 20, d + 10)-(c + 17, d + 12), Color2, BF
    Line (c + 7, d + 10)-(c + 5, d + 12), Color2, BF
    Line (c + 32, d + 12)-(c + 27, d + 14), Color2, BF 'Line 7
    Line (c + 12, d + 12)-(c + 5, d + 14), Color2, BF
    Line (c + 30, d + 14)-(c + 27, d + 16), Color2, BF 'Line 8
    Line (c + 12, d + 14)-(c + 10, d + 16), Color2, BF
    Line (c + 5, d + 14)-(c + 2, d + 16), Color2, BF
    Line (c + 27, d + 16)-(c + 22, d + 18), Color2, BF 'Line 9
    Line (c + 17, d + 16)-(c + 12, d + 18), Color2, BF
    If Counter < 20 * .7 Then Line (c + 2, d + 16)-(c + 0, d + 18), Color2, BF
    Line (c + 22, d + 18)-(c + 17, d + 20), Color2, BF 'End of right moving fish sprite - Line 10

    If c < -99 Then MoveRight2 = 1 'Defines movement is to the right
    If MoveRight2 = 1 Then c = c + 1
    If c = 740 Then c = c - 840 'Stops Movement at 740, then starts again at -840
    If c = -98 Then Color2 = Color2 + 1
    If Color2 = 16 Then Color2 = 1
    If c = -97 Then d = Rnd * 280 + 20

    _Display 'New simpler version of pcopy - Eliminates screen flicker from partial screen refresh frames
Loop